package com.wlyuan.open.domain.api.utils;

import com.wlyuan.open.domain.api.valueobj.Method;
import lombok.extern.slf4j.Slf4j;

import java.util.Optional;

/**
 * @author lijing
 */
@Slf4j
public class MappingMethod {

    public Method create(String method) {
        return Optional.ofNullable(method)
                .map(Method::new)
                .orElse(null);
    }

    public String value(Method source) {
        return Optional.ofNullable(source).map(x -> x.getMethod().toUpperCase()).orElse(null);
    }
}
